﻿<?xml version="1.0" encoding="utf-8"?>
<xsd:schema id="StateMachineLanguageSchema" targetNamespace="http://schemas.microsoft.com/dsltools/StateMachineLanguage" elementFormDefault="qualified" xmlns="http://schemas.microsoft.com/dsltools/StateMachineLanguage" xmlns:core="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:import id="CoreSchema" namespace="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" />
  <!-- StateMachine -->
  <xsd:element name="stateMachine" type="StateMachine" substitutionGroup="core:modelElement" />
  <xsd:complexType name="StateMachine">
    <xsd:annotation>
      <xsd:documentation>The root in which all other elements are embedded. Appears as a diagram.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElement">
        <xsd:sequence minOccurs="0" maxOccurs="1">
          <!-- Relationship: StateMachineHasStates -->
          <xsd:element name="states" minOccurs="0" maxOccurs="1">
            <xsd:annotation>
              <xsd:documentation>Instances of StateMachineHasStates</xsd:documentation>
            </xsd:annotation>
            <xsd:complexType>
              <xsd:sequence>
                <xsd:choice minOccurs="0" maxOccurs="unbounded" >
                  <xsd:element ref="stateMachineHasStates">
                    <xsd:annotation>
                      <xsd:documentation>[Relationship deriving from StateMachineHasStates needs to be serialized in full-form]</xsd:documentation>
                    </xsd:annotation>
                  </xsd:element>
                  <xsd:element ref="baseState" >
                    <xsd:annotation>
                      <xsd:documentation>[Target role-player]</xsd:documentation>
                    </xsd:annotation>
                  </xsd:element>
                </xsd:choice>
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
        </xsd:sequence>
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- StateMachine Moniker -->
  <xsd:element name="stateMachineMoniker" type="StateMachineMoniker" substitutionGroup="core:modelElementMoniker" />
  <xsd:complexType name="StateMachineMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for StateMachine instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElementMoniker">
        <xsd:attribute name="Id" type="xsd:string" >
          <xsd:annotation>
            <xsd:documentation>Attribute to store the moniker string.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- BaseState -->
  <xsd:element name="baseState" abstract="true" type="BaseState" substitutionGroup="core:modelElement" />
  <xsd:complexType name="BaseState" abstract="true" >
    <xsd:annotation>
      <xsd:documentation>Elements embedded in the model. Appear as boxes on the diagram.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElement">
        <xsd:sequence minOccurs="0" maxOccurs="1">
          <!-- Relationship: Transition -->
          <xsd:element name="targets" minOccurs="0" maxOccurs="1">
            <xsd:annotation>
              <xsd:documentation>Instances of Transition</xsd:documentation>
            </xsd:annotation>
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element ref="transition" minOccurs="0" maxOccurs="unbounded">
                  <xsd:annotation>
                    <xsd:documentation>[Instance of Transition needs to be serialized in full-form]</xsd:documentation>
                  </xsd:annotation>
                </xsd:element>
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
        </xsd:sequence>
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- BaseState Moniker -->
  <xsd:element name="baseStateMoniker" abstract="true" type="BaseStateMoniker" substitutionGroup="core:modelElementMoniker" />
  <xsd:complexType name="BaseStateMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for BaseState instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElementMoniker">
        <xsd:attribute name="Id" type="xsd:string" >
          <xsd:annotation>
            <xsd:documentation>Attribute to store the moniker string.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- InitialState -->
  <xsd:element name="initialState" type="InitialState" substitutionGroup="baseState" />
  <xsd:complexType name="InitialState">
    <xsd:complexContent>
      <xsd:extension base="BaseState">
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- InitialState Moniker -->
  <xsd:element name="initialStateMoniker" type="InitialStateMoniker" substitutionGroup="baseStateMoniker" />
  <xsd:complexType name="InitialStateMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for InitialState instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="BaseStateMoniker">
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- State -->
  <xsd:element name="state" type="State" substitutionGroup="baseState" />
  <xsd:complexType name="State">
    <xsd:complexContent>
      <xsd:extension base="BaseState">
        <xsd:sequence minOccurs="0" maxOccurs="1">
          <!-- Relationship: StateReferencesInnerStateMachine -->
          <xsd:element name="innerStateMachine" minOccurs="0" maxOccurs="1">
            <xsd:annotation>
              <xsd:documentation>Instance of StateReferencesInnerStateMachine</xsd:documentation>
            </xsd:annotation>
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element ref="stateReferencesInnerStateMachine" minOccurs="0" maxOccurs="1">
                  <xsd:annotation>
                    <xsd:documentation>[Instance of StateReferencesInnerStateMachine needs to be serialized in full-form]</xsd:documentation>
                  </xsd:annotation>
                </xsd:element>
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
        </xsd:sequence>
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
        <!-- Property: Name -->
        <xsd:attribute name="name" type="xsd:string" />
        <!-- Property: EntryAction -->
        <xsd:attribute name="entryAction" type="xsd:string" />
        <!-- Property: ExitAction -->
        <xsd:attribute name="exitAction" type="xsd:string" />
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- State Moniker -->
  <xsd:element name="stateMoniker" type="StateMoniker" substitutionGroup="baseStateMoniker" />
  <xsd:complexType name="StateMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for State instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="BaseStateMoniker">
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- FinalState -->
  <xsd:element name="finalState" type="FinalState" substitutionGroup="baseState" />
  <xsd:complexType name="FinalState">
    <xsd:complexContent>
      <xsd:extension base="BaseState">
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- FinalState Moniker -->
  <xsd:element name="finalStateMoniker" type="FinalStateMoniker" substitutionGroup="baseStateMoniker" />
  <xsd:complexType name="FinalStateMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for FinalState instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="BaseStateMoniker">
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- Root -->
  <xsd:element name="root" type="Root" substitutionGroup="core:modelElement" />
  <xsd:complexType name="Root">
    <xsd:complexContent>
      <xsd:extension base="core:ModelElement">
        <xsd:sequence minOccurs="0" maxOccurs="1">
          <!-- Relationship: RootHasStateMachines -->
          <xsd:element name="stateMachines" minOccurs="0" maxOccurs="1">
            <xsd:annotation>
              <xsd:documentation>Instances of RootHasStateMachines</xsd:documentation>
            </xsd:annotation>
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element ref="rootHasStateMachines" minOccurs="0" maxOccurs="unbounded">
                  <xsd:annotation>
                    <xsd:documentation>[Instance of RootHasStateMachines needs to be serialized in full-form]</xsd:documentation>
                  </xsd:annotation>
                </xsd:element>
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
        </xsd:sequence>
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
        <!-- dslVersion -->
        <xsd:attribute name="dslVersion" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Version of the model serialized in this file.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- Root Moniker -->
  <xsd:element name="rootMoniker" type="RootMoniker" substitutionGroup="core:modelElementMoniker" />
  <xsd:complexType name="RootMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for Root instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElementMoniker">
        <xsd:attribute name="Id" type="xsd:string" >
          <xsd:annotation>
            <xsd:documentation>Attribute to store the moniker string.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- StateMachineHasStates -->
  <xsd:element name="stateMachineHasStates" abstract="true" type="StateMachineHasStates" substitutionGroup="core:modelElement" />
  <xsd:complexType name="StateMachineHasStates" abstract="true" >
    <xsd:annotation>
      <xsd:documentation>Embedding relationship between the Model and Elements</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElement">
        <xsd:sequence minOccurs="0" maxOccurs="1">
          <!-- Target end BaseState -->
          <xsd:element ref="baseState" minOccurs="1" maxOccurs="1">
            <xsd:annotation>
              <xsd:documentation>[Target role-player]</xsd:documentation>
            </xsd:annotation>
          </xsd:element>
        </xsd:sequence>
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- StateMachineHasStates Moniker -->
  <xsd:element name="stateMachineHasStatesMoniker" type="StateMachineHasStatesMoniker" substitutionGroup="core:modelElementMoniker" />
  <xsd:complexType name="StateMachineHasStatesMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for StateMachineHasStates instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElementMoniker">
        <xsd:attribute name="Id" type="xsd:string" >
          <xsd:annotation>
            <xsd:documentation>Attribute to store the moniker string.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- Transition -->
  <xsd:element name="transition" type="Transition" substitutionGroup="core:modelElement" />
  <xsd:complexType name="Transition">
    <xsd:annotation>
      <xsd:documentation>Reference relationship between Elements.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElement">
        <xsd:sequence minOccurs="0" maxOccurs="1">
          <!-- Target end BaseState -->
          <xsd:element ref="baseStateMoniker" minOccurs="1" maxOccurs="1">
            <xsd:annotation>
              <xsd:documentation>[Target role-player]</xsd:documentation>
            </xsd:annotation>
          </xsd:element>
        </xsd:sequence>
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
        <!-- Property: Trigger -->
        <xsd:attribute name="trigger" type="xsd:string" />
        <!-- Property: Condition -->
        <xsd:attribute name="condition" type="xsd:string" />
        <!-- Property: Action -->
        <xsd:attribute name="action" type="xsd:string" />
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- Transition Moniker -->
  <xsd:element name="transitionMoniker" type="TransitionMoniker" substitutionGroup="core:modelElementMoniker" />
  <xsd:complexType name="TransitionMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for Transition instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElementMoniker">
        <xsd:attribute name="Id" type="xsd:string" >
          <xsd:annotation>
            <xsd:documentation>Attribute to store the moniker string.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- RootHasStateMachines -->
  <xsd:element name="rootHasStateMachines" type="RootHasStateMachines" substitutionGroup="core:modelElement" />
  <xsd:complexType name="RootHasStateMachines">
    <xsd:complexContent>
      <xsd:extension base="core:ModelElement">
        <xsd:sequence minOccurs="0" maxOccurs="1">
          <!-- Target end StateMachine -->
          <xsd:element ref="stateMachine" minOccurs="1" maxOccurs="1">
            <xsd:annotation>
              <xsd:documentation>[Target role-player]</xsd:documentation>
            </xsd:annotation>
          </xsd:element>
        </xsd:sequence>
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- RootHasStateMachines Moniker -->
  <xsd:element name="rootHasStateMachinesMoniker" type="RootHasStateMachinesMoniker" substitutionGroup="core:modelElementMoniker" />
  <xsd:complexType name="RootHasStateMachinesMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for RootHasStateMachines instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElementMoniker">
        <xsd:attribute name="Id" type="xsd:string" >
          <xsd:annotation>
            <xsd:documentation>Attribute to store the moniker string.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- StateReferencesInnerStateMachine -->
  <xsd:element name="stateReferencesInnerStateMachine" type="StateReferencesInnerStateMachine" substitutionGroup="core:modelElement" />
  <xsd:complexType name="StateReferencesInnerStateMachine">
    <xsd:complexContent>
      <xsd:extension base="core:ModelElement">
        <xsd:sequence minOccurs="0" maxOccurs="1">
          <!-- Target end StateMachine -->
          <xsd:element ref="stateMachineMoniker" minOccurs="1" maxOccurs="1">
            <xsd:annotation>
              <xsd:documentation>[Target role-player]</xsd:documentation>
            </xsd:annotation>
          </xsd:element>
        </xsd:sequence>
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- StateReferencesInnerStateMachine Moniker -->
  <xsd:element name="stateReferencesInnerStateMachineMoniker" type="StateReferencesInnerStateMachineMoniker" substitutionGroup="core:modelElementMoniker" />
  <xsd:complexType name="StateReferencesInnerStateMachineMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for StateReferencesInnerStateMachine instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElementMoniker">
        <xsd:attribute name="Id" type="xsd:string" >
          <xsd:annotation>
            <xsd:documentation>Attribute to store the moniker string.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
</xsd:schema>

